Repository navigation
feat(hooks): supply ATOMIC_SESSION_ID to shells for work-start binding - #14
Open
graywolf336 wants to merge 1 commit into
Open
graywolf336 wants to merge 1 commit into
graywolf336 wants to merge 1 commit into
Conversation
The atomic CLI's session-binding flags on intent update (--session-id, or the ATOMIC_SESSION_ID environment variable) let `atomic intent update <id> --status in_progress` bind the governing intent to the active session turn. Without session context the command stays a status-only update and the intent graph never learns which intent governs the turn's recorded changes. Both plugin entrypoints now supply that context: - v1 `shell.env` reads `input.sessionID` (bash tool events carry it; terminal/pty shells do not, keeping the human status-only path). - v2 `create.before` reads `event.sessionID` when the host provides it. Injection is gated on a new read-only `isStarted` tracker lookup: a failed binding fails the whole update, so only sessions whose session-start hook has fired get the variable — the CLI rejects a declaration for an unknown session. Unstarted and terminal shells keep the previous environment exactly. Tests: v1 started/unstarted/terminal shell cases, v2 started/foreign session cases (20 pass). Integration version 1.1.1 -> 1.2.0 so `atomic agent enable` ships the updated package from storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
atomic intent update <id> --status in_progresscan bind the governing intent to the active session turn — the CLI persists the binding under.atomic/sessions/<id>/, and the turn's end-of-turn recording then carries the intent UID inplan_id, which is whatatomic intent graphuses to attribute the turn's recorded changes to that intent. The CLI reads that session context from--session-idor theATOMIC_SESSION_IDenvironment variable, but nothing ever supplied it — so every declaration issued from an agent session stayed a status-only update and the intent graph had noplan_idto read.This plugin now supplies the context: shells launched from a tracked agent session carry
ATOMIC_SESSION_ID, so the plain command the skills already teach binds the turn. No flags needed from the agent.Changes
shell.env: setsATOMIC_SESSION_IDfrominput.sessionID(bash-tool events carry it; terminal/pty shells don't, which keeps the human status-only path).create.before: same, fromevent.sessionIDwhen the host provides it.isStartedtracker lookup — only sessions whosesession-starthook has fired. A failed binding fails the whole update (the CLI binds before it updates status), and the CLI rejects declarations for unknown sessions, so unstarted and terminal shells keep the previous environment exactly.atomic agent enableships the updated package from storage.Notes
requiresstays>=0.11.0for that reason.Verification
bun test— 20 pass. New cases cover v1 started session (injected), unstarted session and terminal shell (not injected, and the lookup materializes no state), v2 started session (injected), and v2 foreign session (not injected).